//全选按钮
var selectEle=document.querySelector(".select-all1");
//确定按钮
var button=document.querySelector(".go-practice");
button.onclick= function (){
    if (selectEle.checked == true) {
        /*console.log("===============");*/
        var programLanguage = document.querySelector(".program-language");
        console.log(programLanguage.innerText);

        window.location.href ="/helloworld/choose/toDetail/all";
    }else{
        var ckboxes=document.querySelectorAll(".icons1[type=checkbox]");

        var character=[];
        for(var i=0;i<ckboxes.length;i++){

            if(ckboxes[i].checked==true){
                character.push(ckboxes[i].parentElement.innerText);
                /*console.log(ckboxes[i].parentElement.innerText);*/
                if(character.length>3){
                    alert("选中的条件大于三个，请重新选择");
                    return;
                }
            }
        }
        console.log(character);

        var hour,minute,second;//时 分 秒
        hour=minute=second=0;//初始化
        localStorage.setItem("hour",0);
        localStorage.setItem("minute",0);
        localStorage.setItem("second",0);

        window.location.href ="/helloworld/choose/toDetail/"+character.join(","); //join:把数组转换成字符串，拼接
    }



}

//重选按钮
var reSelect=document.querySelector(".reselect-btn");

var ckboxes=document.querySelectorAll(".icons1[type=checkbox]");

reSelect.onclick=function(){
    /*console.log("*****************************");*/
    var icons=[];
    for(var i=0;i<ckboxes.length;i++){
        if(ckboxes[i].checked==true)
            ckboxes[i].checked=false;
        else if(selectEle.checked==true)
            selectEle.checked=false;
    }
}



//全选的
selectEle.onclick=function(){
    var ckboxes=document.querySelectorAll(".type0 input[type=checkbox]");
    for(var i=0;i<ckboxes.length;i++){
        ckboxes[i].checked=selectEle.checked;
        console.log(ckboxes[i].parentElement.innerText)
    }
}


